﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;

namespace SLARToolKitWinPhoneSample
{
    public partial class pageDessert : PhoneApplicationPage
    {
        public pageDessert()
        {
            InitializeComponent();
            string[] arr1 = new string[] { "Apple Pie", "Sundae", "Cornetto Sundae", "Sundae Cone", "Cornetto McFlurry" };

            string[] images = new string[] { "apple", "sunChoco", "CorsunStraw", "cone", "fluOreo" };

            for (int i = 0; i < arr1.Length; ++i)
            {
                List_row row = new List_row();
                row.title.Text = arr1[i];

                row.myimage.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("DessertImage/" + images[i] + ".png");
                DessertList.Items.Add(row);

            }


            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {

        }
        void DessertList_SelectionChanged(object sender, SelectionChangedEventArgs args)
        {
            int BIndex = DessertList.SelectedIndex + 1;

            switch (BIndex)
            {
                case 1:
                    NavigationService.Navigate(new Uri("/Dessert/De1.xaml", UriKind.Relative));
                    break;

                case 2:
                    NavigationService.Navigate(new Uri("/Dessert/De2.xaml", UriKind.Relative));
                    break;

                case 3:
                    NavigationService.Navigate(new Uri("/Dessert/De3.xaml", UriKind.Relative));
                    break;

                case 4:
                    NavigationService.Navigate(new Uri("/Dessert/De4.xaml", UriKind.Relative));
                    break;

                case 5:
                    NavigationService.Navigate(new Uri("/Dessert/De5.xaml", UriKind.Relative));
                    break;




                default:
                    break;
            }
        }
    }
}